<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>微任务处理</title>
</head>
<body>
    <script>
        //使用微任务处理
        //目的只有一个   不耽搁同步代码的执行
        async function hd(num){
            let res = await Promise.resolve().then(_ => {
                let count = 0;
                for(let i = 0 ; i < num; i++){
                    count += num--;
                }
                return count;
            });
            console.log(res);
        }
        hd(987654321);
        console.log("后盾人");
    </script>
</body>
</html>